package com.yoda.mall.admin.intercepter;
import com.yoda.mall.model.entity.ums.Admin;


public class ThreadContext {
    /**
     * 线程变量副本数据
     */
    private static final ThreadLocal<Admin> threadLocal = new ThreadLocal<>();

   public static void setAdminId(Long id){
       threadLocal.get().setId(id);
   }

   public static Long getAdminId(){
       return threadLocal.get().getId();
   }

   public static void clear(){
       threadLocal.remove();
   }

    public static void setUsername(String username) {
        threadLocal.get().setUsername(username);
    }

    public static String getUsername() {
       return threadLocal.get().getUsername();
    }

    public static void setAdmin(Admin admin) {
        threadLocal.set(admin);
    }

    public static Admin getAdmin() {
       return threadLocal.get();
    }

}
